"""init

Revision ID: ac416b1b733f
Revises: 
Create Date: 2025-11-16 16:26:48.386877

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
import sqlmodel

# revision identifiers, used by Alembic.
revision: str = 'ac416b1b733f'
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('glass',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('create_time', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.Column('update_time', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
    sa.Column('description', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_glass_name'), 'glass', ['name'], unique=True)
    op.create_table('logs',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('create_time', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.Column('update_time', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.Column('request_id', sa.Uuid(), nullable=False),
    sa.Column('ip', sqlmodel.sql.sqltypes.AutoString(length=50), nullable=True),
    sa.Column('method', sqlmodel.sql.sqltypes.AutoString(length=10), nullable=True),
    sa.Column('url', sqlmodel.sql.sqltypes.AutoString(length=200), nullable=True),
    sa.Column('path_params', sa.JSON(), nullable=True),
    sa.Column('query_params', sa.JSON(), nullable=True),
    sa.Column('request_body', sa.JSON(), nullable=True),
    sa.Column('status_code', sa.Integer(), nullable=True),
    sa.Column('response_body', sa.JSON(), nullable=True),
    sa.Column('process_time', sa.Float(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('logs')
    op.drop_index(op.f('ix_glass_name'), table_name='glass')
    op.drop_table('glass')
    # ### end Alembic commands ###
